package com.esri.core.tasks.na;

import com.esri.core.geometry.Envelope;
import com.esri.core.map.Graphic;
import com.github.mikephil.charting.utils.Utils;
import java.util.ArrayList;
import java.util.List;

/* loaded from: classes.dex */
public class Route {
    private static final String totalPrefix = "Total_";
    private static final String violationPrefix = "TotalViolation_";
    private static final String waitPrefix = "TotalWait_";
    Envelope envelope;
    Graphic route;
    int routeID;
    String routeName;
    double totalLength = Utils.DOUBLE_EPSILON;
    double totalMiles = Utils.DOUBLE_EPSILON;
    double totalKilometers = Utils.DOUBLE_EPSILON;
    double totalTime = Utils.DOUBLE_EPSILON;
    double totalDriveTime = Utils.DOUBLE_EPSILON;
    double totalWaitTime = Utils.DOUBLE_EPSILON;
    double totalViolationTime = Utils.DOUBLE_EPSILON;
    double totalStopTime = Utils.DOUBLE_EPSILON;
    List<RouteDirection> routingDirections = new ArrayList();

    public Graphic getRouteGraphic() {
        return this.route;
    }

    public String getRouteName() {
        return this.routeName;
    }

    public double getTotalMiles() {
        return this.totalMiles;
    }

    public double getTotalKilometers() {
        return this.totalKilometers;
    }

    public double getTotalMinutes() {
        return this.totalTime;
    }

    public double getTotalViolationMinutes() {
        return this.totalViolationTime;
    }

    public double getTotalWaitMinutes() {
        return this.totalWaitTime;
    }

    public Envelope getEnvelope() {
        return this.envelope;
    }

    public double getTotalCost(String str) {
        return getDoubleAttributeValue(totalPrefix + str);
    }

    public List<RouteDirection> getRoutingDirections() {
        return new ArrayList(this.routingDirections);
    }

    public int hashCode() {
        Envelope envelope = this.envelope;
        int hashCode = ((envelope == null ? 0 : envelope.hashCode()) + 31) * 31;
        Graphic graphic = this.route;
        int hashCode2 = (((hashCode + (graphic == null ? 0 : graphic.hashCode())) * 31) + this.routeID) * 31;
        String str = this.routeName;
        int hashCode3 = (hashCode2 + (str == null ? 0 : str.hashCode())) * 31;
        List<RouteDirection> list = this.routingDirections;
        int hashCode4 = list != null ? list.hashCode() : 0;
        long doubleToLongBits = Double.doubleToLongBits(this.totalDriveTime);
        long doubleToLongBits2 = Double.doubleToLongBits(this.totalLength);
        long doubleToLongBits3 = Double.doubleToLongBits(this.totalTime);
        return ((((((hashCode3 + hashCode4) * 31) + ((int) (doubleToLongBits ^ (doubleToLongBits >>> 32)))) * 31) + ((int) (doubleToLongBits2 ^ (doubleToLongBits2 >>> 32)))) * 31) + ((int) ((doubleToLongBits3 >>> 32) ^ doubleToLongBits3));
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            Route route = (Route) obj;
            Envelope envelope = this.envelope;
            if (envelope == null) {
                if (route.envelope != null) {
                    return false;
                }
            } else if (!envelope.equals(route.envelope)) {
                return false;
            }
            Graphic graphic = this.route;
            if (graphic == null) {
                if (route.route != null) {
                    return false;
                }
            } else if (!graphic.equals(route.route)) {
                return false;
            }
            if (this.routeID != route.routeID) {
                return false;
            }
            String str = this.routeName;
            if (str == null) {
                if (route.routeName != null) {
                    return false;
                }
            } else if (!str.equals(route.routeName)) {
                return false;
            }
            List<RouteDirection> list = this.routingDirections;
            if (list == null) {
                if (route.routingDirections != null) {
                    return false;
                }
            } else if (!list.equals(route.routingDirections)) {
                return false;
            }
            return Double.doubleToLongBits(this.totalDriveTime) == Double.doubleToLongBits(route.totalDriveTime) && Double.doubleToLongBits(this.totalLength) == Double.doubleToLongBits(route.totalLength) && Double.doubleToLongBits(this.totalTime) == Double.doubleToLongBits(route.totalTime);
        }
        return false;
    }

    public String toString() {
        return String.format("Route [Name=%s, Miles=%f, Kilometers=%f, Minutes=%f]", this.routeName, Double.valueOf(this.totalMiles), Double.valueOf(this.totalKilometers), Double.valueOf(this.totalTime));
    }

    private double getDoubleAttributeValue(String str) {
        Graphic graphic;
        if (str == null || str.isEmpty() || (graphic = this.route) == null) {
            return Utils.DOUBLE_EPSILON;
        }
        Object attributeValue = graphic.getAttributeValue(str);
        return attributeValue instanceof Double ? ((Double) attributeValue).doubleValue() : Utils.DOUBLE_EPSILON;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void updateConvenience(String str, String str2, double d, double d2, double d3) {
        if (str != null && !str.isEmpty()) {
            this.totalTime = getTotalCost(str) * d;
            this.totalViolationTime = getDoubleAttributeValue(violationPrefix + str) * d;
            this.totalWaitTime = getDoubleAttributeValue(waitPrefix + str) * d;
            this.totalDriveTime = this.totalDriveTime * d;
            for (RouteDirection routeDirection : this.routingDirections) {
                routeDirection.setTime(routeDirection.getMinutes() * d);
            }
        }
        if (str2 == null || str2.isEmpty()) {
            return;
        }
        this.totalMiles = getTotalCost(str2) * d2;
        this.totalKilometers = getTotalCost(str2) * d3;
    }
}
